package br.upe.dsc.caeto.ui;

import javax.swing.JPanel;
import javax.swing.JDialog;

import java.awt.Color;
import java.awt.Font;
import java.awt.Rectangle;
import javax.swing.BorderFactory;
import javax.swing.border.TitledBorder;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.UIManager;

public class TechnologyParametersDialog extends JDialog {

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JPanel PrincipalPanel = null;

	private JLabel tensaoLabel = null;

	private JLabel transistorLabel = null;

	private JTextField tensaoTextField = null;

	private JTextField transistorTextField = null;

	private JButton okButton = null;

	private JButton CancelarButton = null;

	/**
	 * @param owner
	 */
	public TechnologyParametersDialog() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		//Faz a GUI utilizar o mesmo tema do sistema operacional 
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
			//Nao foi possivel utilizar o tema do sistema operacinal.
			//Abre a GUI com o tema configurado como o padrao de JAVA no sistema
			e.printStackTrace();
		}
		
		this.setSize(400, 165);
		this.setTitle("Tecnologia da Cache");
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		this.setLocationRelativeTo(null);// abre no centro
		this.setAlwaysOnTop(true);
		this.setContentPane(getJContentPane());
		
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(null);
			jContentPane.add(getPrincipalPanel(), null);
			jContentPane.add(getOkButton(), null);
			jContentPane.add(getCancelarButton(), null);
		}
		return jContentPane;
	}

	/**
	 * This method initializes PrincipalPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getPrincipalPanel() {
		if (PrincipalPanel == null) {
			transistorLabel = new JLabel();
			transistorLabel.setBounds(new Rectangle(14, 52, 182, 28));
			transistorLabel.setText("Tecnologia de transistors (Mm):");
			tensaoLabel = new JLabel();
			tensaoLabel.setBounds(new Rectangle(14, 17, 182, 28));
			tensaoLabel.setText("Tenso de alimentao (Volts):");
			PrincipalPanel = new JPanel();
			PrincipalPanel.setLayout(null);
			PrincipalPanel.setBounds(new Rectangle(5, 5, 380, 87));
			PrincipalPanel.setBorder(BorderFactory.createTitledBorder(null, "Tecnologia da Cache:", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
			PrincipalPanel.add(tensaoLabel, null);
			PrincipalPanel.add(transistorLabel, null);
			PrincipalPanel.add(getTensaoTextField(), null);
			PrincipalPanel.add(getTransistorTextField(), null);
		}
		return PrincipalPanel;
	}

	/**
	 * This method initializes tensaoTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getTensaoTextField() {
		if (tensaoTextField == null) {
			tensaoTextField = new JTextField();
			tensaoTextField.setBounds(new Rectangle(209, 17, 158, 25));
		}
		return tensaoTextField;
	}

	/**
	 * This method initializes transistorTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getTransistorTextField() {
		if (transistorTextField == null) {
			transistorTextField = new JTextField();
			transistorTextField.setBounds(new Rectangle(209, 52, 158, 25));
		}
		return transistorTextField;
	}

	/**
	 * This method initializes okButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getOkButton() {
		if (okButton == null) {
			okButton = new JButton();
			okButton.setBounds(new Rectangle(293, 97, 88, 27));
			okButton.setText("Ok");
		}
		return okButton;
	}

	/**
	 * This method initializes CancelarButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getCancelarButton() {
		if (CancelarButton == null) {
			CancelarButton = new JButton();
			CancelarButton.setBounds(new Rectangle(198, 97, 88, 27));
			CancelarButton.setText("Cancelar");
		}
		return CancelarButton;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
